home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
The World of Computer Software.iso
/
gfonts45.zip
/
GFONTS45.DOC
< prev
next >
Wrap
Text File
|
1993-01-06
|
15KB
|
323 lines
G F O N T S
Version 4.5 - January, 1993
Dwain Goforth
Milestone Software
1260 Sunset Ave., Arcata, CA 95521
(707) 822-1291
WHAT IS GFONTS?
GFONTS is a package of 87 graphic fonts in either QuickBASIC or assembly
language for use in your QB programs. Each font is in its own subprogram
that you CALL from within QB. The fonts are named by the ROM character set
they read, the size in pixels (in x and y dimensions), and occasionally with
a tag like "ital" meaning italics.
GFONTS works with QuickBASIC 4.x and BASIC 7.x (far string support is
included.)
There are two methods that GFONTS uses to display fonts and two sources for
the font character data. GFONTS includes 26 assembly language font routines
and 61 QuickBASIC font routines. Also GFONTS can use either native character
sets found in your video ROM or font files BLOADed from disk.
ALL source code is included, allowing you to customize your own fonts.
The QB subroutine fonts are in individual subprograms for three reasons: 1)
They are faster this way. 2) Only those fonts you wish to use can be kept in
your final program, reducing the overhead in your program. 3) As discrete
units, a font can be copied to a new subprogram and easily modified to
create a new custom font.
-----------------------------
The GFONTS package comes with the following files:
$GFASM.BAS - Source code for initializing the assembly language GFONT
routines. It also has complete code to BLOAD both 4k 8x16 pixel font files
(for use with the VGAxxx assembly routines) and 12k 16x24 pixel font files
for use with USER24. Proportionally-spaced versions of the assembly
fonts are new in version 4.0.
$GF.BAS - The source code for all the QuickBASIC subprogram fonts that use
the hardwired 8x8 pixel ROM character set that is found in all IBM and clone
computers, including the required initialization statements. $GFE.BAS - The
source code for all the QuickBASIC subprogram fonts that use the EGA BIOS
ROM character set. An EGA video card and monitor are required.
$GFV.BAS - The source code for all the QuickBASIC subprogram fonts that
EITHER use the VGA BIOS ROM character set (VGA required), OR the 4k 8x16
pixel font files.
$PROPOR.BAS - Source code for proportionally-spaced 4k font files.
ASMTEST.BAS - Demo of the assembly fonts.
GFTEST.BAS - Demo of all the QB fonts with comments and tips on using
GFONTS. By browsing the code, you will see the purpose of each statement
and learn how to make your own fonts.
PROPOR.BAS - Demo of the $PROPOR.BAS font files.
GFASM.xxx - GFASM contains the call to GFTBL to get the addresses of the EGA
and VGA ROM character sets as well as the calls to the 26 assembly language
fonts. GFASM.ASM is the source code, GFASM.OBJ is the compiled source code,
GFASM.QLB is the QuickLibrary (for running in the QB environment), and
GFASM.LIB is the library (for compiling into an EXE program.) The BASIC 7.x
versions of these files are called GFASM7.xxx.
COMPARE.BAS - Kind of like TESTFONT, only better. Allows you to show two 4k
fonts side by side so you can choose which you like better.
TEXTBOX.BAS - Use assembly language GFONTS in a self-wrapping graphics
textbox!
EGACRSR.BAS - A short program showing how you can produce a blinking cursor
with the assembly language GFONTS.
GLOW.BAS - For VGA card owners only, this program demonstrates fading the
palette in and out, a nice effect.
YNBUTTON.BAS - A demo of a routine you can use or modify to have buttons pop
up on the screen. A thousand and one uses.
CIRCLE.BAS - A demo just for fun to show the potential of GFONTS. This code
is shown at the end of GFDEMO.EXE.
GFCNVRT.BAS - This program will convert font files created with the public
domain program, FONTEDIT.COM into BLOADable font table files. These 4k
files can then be used with the VGA GFONT calls. You don't need a VGA to
use this method as the tables are loaded from disk, not video BIOS. But the
VGA GFONT calls are used because they also use an 8x16 matrix. If you have
a VGA you can use both the ROM table and file table(s).
TESTFILE.BAS - Demonstrates BLOADing 4k font files into BASIC and using the
font with the regular PRINT statement. GFONTS is not really used at all.
You must load QB with the QB.QLB quicklibrary which includes the INTERRUPTX
routine.
BIGFONT.EXE - Two versions of this program are included, one for EGA owners
and the other for VGA (they both produce identical font files so if you have
a VGA you can discard the EGA version.) BIGFONT is a font editor for 16x24
pixel characters (three times as many pixels as an 8x16 grid.) This new size
allows detailed type-faces. Font files (12k) created with BIGFONT are meant
to be BLOADed into your QB program and then displayed using the assembly
USER24 call. BIGFONT font files have proportion al spacing built into them
and display very fine with USER24p.
*.FNT files - There are two kinds of font files with GFONTS (20+ are
included.) The first are 4k in size and are meant to be used with the QB
GFVxxx subroutines and/or the VGAxxx assembly routines. Each character is 8
by 16 pixels in size. The second kind of .FNT file are those 12k in size
that were created with BIGFONT.EXE. Each character is 16 by 24 pixels in
size. These files are meant to be displayed with the assembly routines
USER24 and USER24p.
FONTEDIT.COM - Michael Mefford's font generating program from PC Magazine
(see FONTEDIT.DOC for info.) Provided so users could make their own 4k font
files. .COM files created with FONTEDIT must be converted to GFONT font
files using GFCNVRT.BAS.
Also included in the GFONTS package are a 16-PAGE MANUAL and QUICK
REFERENCE SHEET.
------------------------
HOW GFONTS WORKS:
Every PC has a built-in table of alphanumeric characters in ROM memory.
This table is located at the beginning of segment &HFFA6. Each character is
8 by 8 pixels in size and is represented by the 8 bits in each of 8 bytes
(one for each scan line.) If a bit = 0 it is off and if the bit = 1 it is
turned on.
If you have an EGA or VGA adapter you have additional ROM character sets
located in the video BIOS. EGA has an 8x12 pixel character set (actually in
an 8x14 matrix) and VGA has an 8x14 character set (in an 8x16 matrix.) Thus,
a VGA has three separate sets; 8x8, 8x14 and 8x16, because VGA also emulates
an EGA. Knowing this, it is possible to make up to three versions of each
font technique.
BASIC has a few intrinsic commands for turning pixels on; LINE, PSET,
CIRCLE, etc... If a BASIC program can read the data bytes in the ROM
character table itself, or load such a table from disk, it can reproduce the
character using BASIC pixel commands instead of the PRINT statement. An
ingenious method using the LINE command as a bit-mask for each byte was
published in PC Magazine. This was the springboard for GFONTS.
Accessing the ROM BIOS EGA and VGA character sets is not as easy as the 8x8
set because EGA and VGA video BIOS addresses are not standardized, and may,
in fact, be copied into RAM for faster execution. Furthermore, when you
enter graphics mode, your VGA ROM table is moved again! Since DOS and the
video BIOS must coexist, the video BIOS pokes some pertinent addresses into
DOS and someone was thoughtful enough to add a DOS interrupt to query the
location of the EGA and VGA tables. This is INT 10 where the A X register =
1130h (another method to find the current table is the vector at Interrupt
43h.)
What this means to you is that in order to use the ROM EGA and VGA GFONTS
you must first make a call to DOS, get the EGA/VGA addresses and assign them
to SHARED variables which the GFONTS routines can then use to display the
data. Please note this only has to be done once, at the beginning of each
program. You initialize these addresses by CALLing GFTBL (which is in
GFASM.QLB and .LIB). Because the VGA table may be moved when you enter
graphics mode you must have a SCREEN 12 statement just prior to the G FTBL
call.
QuickBASIC does have a method for accessing DOS interrupt calls. It is
located in the QB.LIB and QB.QLB files that come with QuickBASIC, and it is
called INTERRUPTX. INTERRUPTX is a nice routine, but it is a little
overkill for our purposes because it requires the definition of a TYPE array
for all the registers and flags. Plus you have to call it twice, once for
the EGA address and once for the VGA. Since small (and fast) is beautiful
in computer programs I have included GFTBL, which takes care of your DOS
call in about 100 bytes.
The following is the minimum code to set up GFONTS (after loading QB with
the GFASM quicklibrary):
DIM SHARED EGAseg%, EGAoffset%, VGAseg%, VGAoffset%
SCREEN 9
CALL GFTBL (EGAseg%, EGAoffset%, VGAseg%, VGAoffset%)
The DIM SHARED above would be replaced with COMMON SHARED if your
GFONT routines are located in a separate module (LOADed rather than
MERGEd.)
Now you are ready to call any of the assembly language calls, like
this...
CALL EGA16x36 ("This is a test", xstart, ystart, xstep, ystep, kolor)
It's that easy!
----------------------
BLOADing a font table:
Whether or not you have a VGA, the CALLs to the BASIC "GFVxxx" fonts and the
assembly "VGAxxx" fonts will work if you have BLOADed a font table file into
RAM memory and then use its address instead of one you got from the ROM
BIOS. With a CGA, HERC or EGA you can consider the VGA calls as *requiring*
a disk font. If you have a VGA you can store the ROM BIOS address in backup
variables and switch back and forth between ROM and your BLOADed font(s).
The following is the minimum code you will need to use a BLOADed 4k font
file with the GFVxxx or VGAxxx GFONTS:
REDIM FontArray(0 TO 2047) AS INTEGER ' create a 4096 byte array and load
DEF SEG = VARSEG(FontArray(0)) ' load the font file you created.
BLOAD "filename.fnt", VARPTR(FontArray(0))
VGAseg = VARSEG(FontArray(0))
VGAoffset = 0
Remember that VGAseg and VGAoffset are SHARED or COMMON variables that the
BASIC GFONT routines use. If you have a VGA, you will probably want to save
the values you got from GFTBL into VGAseg and VGAoffset into backup
variables (or you can call GFTBL again to use the VGA ROM characters.)
After BLOADing your font file you can then call any of the GFVxxx routines
like this:
CALL GFVxxx(a$, x, y, xs, ys, clr)
Or to call the VGAxxx assembly routines:
CALL VGAxxx(VGAseg, VGAoffset, a$, x, y, xs, ys, clr)
See the demo BASIC files, ASMTEST.BAS, COMPARE.BAS, TESTFONT.BAS and GFTEST.BAS for examples of BLOADing font files.
BIGFONT.EXE and USER24:
Sometimes you just can't get enough information into an 8x16 pixel grid, so
BIGFONT.EXE and the assembly routines USER24 and USER24p are included with
GFONTS. With BIGFONT you create a 16x24 pixel character set file, then you
BLOAD the file into your QB program and CALL USER24 to display them. USER24
is part of GFASM.QLB and .LIB.
You'll see right away that a 16x24 pixel grid allows creation of custom
fonts with real character (pun intended). And because they are written
directly to video memory with assembly speed they are very fast. Because of
this you can make fonts smaller than 16x24 (say a vertical 8x16) and zip
them on the screen. GFONTS comes with a set of these 12k font files. You
can also wish to design your own sprites or icons for games and special
effects. While USER24 will only display single-colored characters, it is
very fast.
BLOADing a BIGFONT 12k font file is the same as a 4k file (except the array
is bigger.) Please see ASMTEST.BAS for the code and demo of the USER24 call.
--------------------
I have performed a limited amount of speed testing for the various compiled
options of the GFONTS routines.
BASIC GFONTS:
GFTEST.BAS (ver 3.0) was compiled without any pauses and timed using three
compiling options on a 12 mhz 286.
COMPILER LIBRARY STRING MEM AVG. TIME (seconds)
----------------------------------------------------
BC 7.0 GFASM7 Far 19.04
BC 7.0 GFASM Near 18.83
BC 6.0 (QB 4.1) GFASM Near 18.71
Results: Compiling using near strings (GFASM) is slightly faster, due to
the reduced overhead of the near strings.
ASSEMBLY GFONTS:
The following test shows the result of three EXE files displaying a line of
each of the thirteen assembly GFONT routines fifteen times (total calls =
195) on a 12 mhz 286.
COMPILER LIBRARY STRING MEM AVG. TIME (seconds)
----------------------------------------------------
BC 7.0 GFASM7 Far 2.37
BC 7.0 GFASM Near 2.57
BC 6.0 (QB 4.1) GFASM Near 2.58
Results: Compiling as far strings (GFASM7) is slightly faster, probably due
to the fact that the assembly variables are placed in the code segment for
GFASM7 while the variables must be placed in the data (DGROUP) segment in
the near-string version (GFASM) and segment adresses have to be flip-flopped
to retain access to DGROUP variables.
CONCLUSIONS: It's basically six of one and half-dozen of the other. GFONTS
performs relatively equivalent whether near or far strings and whether BASIC
6.0 (= QB 4.x) or BASIC 7.0. If speed is a concern, stick to the assembly
fonts as much as possible.
P.S. I have tested GFASM (near strings) and the assembly fonts in Crescent
Software's PDQ. They work fine. The BASIC GFONTS will *NOT* work in PDQ as
they use BASIC's graphics commands (LINE, CIRCLE, PSET, etc...)
---------------------
The above text is just a portion of the 16-page manual which comes with
GFONTS 4.5. Also included are a complete trouble-shooting guide,
instructions for creating quicklibraries, full instructions for passing
parameters (and doing tricks) to GFONT routines, and a separate
quick-reference guide with complete calling syntax for all routines.
GFONTS 4.5 costs $40 (U.S. currency or cheque drawn on U.S. bank only.)
Credit card orders are NOT acceptable. Shipping is free to anywhere in the
world (GFONTS has sold in 15 countries, now.)
Please indicate if you would like GFONTS sent on 5.25 or 3.5 inch diskettes.
Thank you for trying GFONTS.
Dwain Goforth
1260 Sunset Ave.
Arcata, CA 95521
(707) 822-1291